From: Brion Vibber Date: Sun, 21 Dec 2003 06:33:57 +0000 (+0000) Subject: Avoid saving to linkscc if the article doesn't exist; this leaves X-Git-Tag: 1.3.0beta1~1224 X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=commitdiff_plain;h=1baf68953ae2a81d9941d3024f9725a782b448fe;p=lhc%2Fweb%2Fwiklou.git Avoid saving to linkscc if the article doesn't exist; this leaves corrupt entries in the table. Also, include the column names in the REPLACE statement to guard against potential ordering problems in databases that are manually munged around. --- diff --git a/includes/LinkCache.php b/includes/LinkCache.php index 63e7326a5f..554a7ca543 100644 --- a/includes/LinkCache.php +++ b/includes/LinkCache.php @@ -178,6 +178,12 @@ class LinkCache { $id = $fromtitle->getArticleID(); $this->resume(); + if( $id == 0 ) { + wfDebug( "$fname - got id 0 for title '" . $fromtitle->getPrefixedDBkey() . "'\n" ); + wfProfileOut( $fname ); + return; + } + $sql = "SELECT bl_to FROM brokenlinks WHERE bl_from='{$id}'"; @@ -197,9 +203,9 @@ class LinkCache { } else { $ser = wfStrencode( serialize( $this ) ); } - wfQuery("REPLACE INTO linkscc VALUES({$id}, '{$dbkeyfrom}', '{$ser}')", + wfQuery("REPLACE INTO linkscc(lcc_pageid,lcc_title,lcc_cacheobj) VALUES({$id}, '{$dbkeyfrom}', '{$ser}')", DB_WRITE); - wfDebug( "LinkCache::preFill - saved to linkscc\n" ); + wfDebug( "$fname - saved to linkscc\n" ); } wfProfileOut( $fname );